home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TeX 1995 July
/
TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO
/
dviware
/
dvibook
/
libtex
/
strsave.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-03-18
|
587b
|
30 lines
/*
* Copyright (c) 1987, 1989 University of Maryland
* Department of Computer Science. All rights reserved.
* Permission to copy for any purpose is hereby granted
* so long as this copyright notice remains intact.
*/
/*
* Save a string in managed memory.
*/
char *malloc(), *realloc();
extern int errno;
#include "types.h" /* for bcopy */
#include "error.h"
char *
strsave(s)
register char *s;
{
register int l = strlen(s) + 1;
register char *p = malloc((unsigned) l);
if (p == 0)
error(1, errno, "no room for %d bytes of string", l);
bcopy(s, p, l);
return (p);
}